/*
 * @Date: 2023-01-22 02:17:37
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-24 05:12:37
 * @FilePath: \campus-repair-platform\server\common\sql_sentences\repairer.js
 */
/**
 * select   查询维修人员
 * selectPhone 查询所有手机号
 * selectCount  总数查询
 * selectLimit  分页查询
 * idSelect 根据id查询维修人员
 * insert   添加维修人员
 * idUpdate     根据Id修改维修人员信息
 * phoneUpdatePwd  根据手机号修改维修人员密码
 * delete       根据id删除维修人员
 */

const util = require("../util")
const table = "repairer"
const str = "job_number, name, gender, hex(type_id) type_id, state, phone"

exports.select = (data, field) =>
  util.select(field ? str + ',' + field : str, table, util.selectTransition(data))

exports.selectPhone = (phone) => util.selectPhone(phone)

exports.selectCount = (data) =>
  util.selectCount(table, util.selectTransition(data))

exports.selectLimit = (data, page, pagesize) => util.selectLimit(str, table, util.selectTransition(data), page, pagesize)

exports.idSelect = (id, field) => util.idSelect(field || str, table, id)

exports.insert = (data) =>
  util.insert(table, util.insertStr(data), util.insertTransition(data))

exports.idUpdate = (data, id) =>
  util.idUpdate(table, util.updateTransition(data), id)

exports.phoneUpdatePwd = (password, phone) =>
  util.phoneUpdatePwd(table, password, phone)

exports.delete = (id) => util.delete(table, id)
